package com.x.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

import java.nio.charset.StandardCharsets;

/**
 * the class of advance
 *
 * <p>
 * .
 *
 * @author little_lunatic
 * @date 2024-08-23
 */
@Configuration
public class LanguageConfiguration {

    @Bean
    public MessageSource messageSource(){
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        // 自定义查找前缀
        resourceBundleMessageSource.setBasename("i18n");
        resourceBundleMessageSource.setDefaultEncoding(StandardCharsets.UTF_8.name());
        return resourceBundleMessageSource;
    }
}
